package com.pengliu.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.pengliu.common.bean.SysRole;
import com.pengliu.common.bean.SysUser;
import com.pengliu.common.bean.SysUserExample;
import com.pengliu.common.manager.ManagerImpl;
import com.pengliu.common.mybatis.mapper.Mapper;
import com.pengliu.dao.SysRoleMapper;
import com.pengliu.dao.SysUserMapper;
import com.pengliu.service.SysUserService;

@Service
public class SysUserServiceImpl extends ManagerImpl<SysUser, SysUserExample, Integer> implements SysUserService{

	@Autowired
	SysUserMapper sysUserMapper;
	
	@Autowired
	SysRoleMapper sysRoleMapper;
	
	@Override
	public Mapper<SysUser, SysUserExample, Integer> getMapper() {
		return sysUserMapper;
	}
	
	/**
	 * user: pengliu
	 * date: 2017年10月12日
	 * desc: 根据用户ID获取角色
	 * @param sysUserId
	 * @return
	 */
	public List<SysRole> getRoleByUserId(Integer sysUserId){
		return sysRoleMapper.findBySysUserId(sysUserId);
	}
}
